From: Carlos Garnacho Date: Fri, 26 Jan 2024 15:32:19 +0000 (+0100) Subject: keyboard: Handle extended keyboards through TERMINAL input purpose X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~281^2~1^2~84 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=35bfb4501d3b43424334ff25cf1d9197ea931a1e;p=gnome-shell.git keyboard: Handle extended keyboards through TERMINAL input purpose Drop the channeling of this specific signal from the InputMethod, and update the OSK Keyboard object to using the purpose hint to find out whether a extended keymap is necessary. Part-of: --- diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js index 53af39d85..b393972ec 100644 --- a/js/misc/inputMethod.js +++ b/js/misc/inputMethod.js @@ -21,7 +21,6 @@ const HAVE_REQUIRE_SURROUNDING_TEXT = GObject.signal_lookup('require-surrounding export const InputMethod = GObject.registerClass({ Signals: { 'surrounding-text-set': {}, - 'terminal-mode-changed': {}, }, }, class InputMethod extends Clutter.InputMethod { _init() { @@ -34,7 +33,6 @@ export const InputMethod = GObject.registerClass({ this._preeditAnchor = 0; this._preeditVisible = false; this._hidePanelId = 0; - this.terminalMode = false; this._ibus = IBus.Bus.new_async(); this._ibus.connect('connected', this._onConnected.bind(this)); this._ibus.connect('disconnected', this._clear.bind(this)); @@ -229,7 +227,6 @@ export const InputMethod = GObject.registerClass({ this._surroundingTextCursor = null; this._surroundingTextAnchor = null; this._preeditStr = null; - this._setTerminalMode(false); } vfunc_set_cursor_location(rect) { @@ -302,21 +299,11 @@ export const InputMethod = GObject.registerClass({ IBus.InputPurpose.TERMINAL) ibusPurpose = IBus.InputPurpose.TERMINAL; - this._setTerminalMode( - purpose === Clutter.InputContentPurpose.TERMINAL); - this._purpose = ibusPurpose; if (this._context) this._context.set_content_type(this._purpose, this._hints); } - _setTerminalMode(terminalMode) { - if (this.terminalMode !== terminalMode) { - this.terminalMode = terminalMode; - this.emit('terminal-mode-changed'); - } - } - vfunc_filter_key_event(event) { if (!this._context) return false; diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 224e74f97..6896fad9c 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -1413,10 +1413,6 @@ export const Keyboard = GObject.registerClass({ this._updateKeys(); - Main.inputMethod.connectObject( - 'terminal-mode-changed', this._onTerminalModeChanged.bind(this), - this); - this._keyboardController.connectObject( 'active-group', this._onGroupChanged.bind(this), 'groups-changed', this._onKeyboardGroupsChanged.bind(this), @@ -1493,7 +1489,12 @@ export const Keyboard = GObject.registerClass({ } _ensureKeys() { - const group = this._keyboardController.getCurrentGroup(); + let group; + if (this._purpose === Clutter.InputContentPurpose.TERMINAL) + group = 'us-extended'; + else + group = this._keyboardController.getCurrentGroup(); + if (!this._groups[group]) this._groups[group] = this._createLayersForGroup(group); } @@ -1617,7 +1618,7 @@ export const Keyboard = GObject.registerClass({ if (enabled && (!Main.inputMethod.currentFocus || Main.inputMethod.hasPreedit() || - Main.inputMethod.terminalMode)) { + this._purpose === Clutter.InputContentPurpose.TERMINAL)) { this._keyboardController.keyvalPress(Clutter.KEY_BackSpace); this._backspacePressed = true; return; @@ -1803,10 +1804,6 @@ export const Keyboard = GObject.registerClass({ this._updateKeys(); } - _onTerminalModeChanged() { - this._updateKeys(); - } - _onKeyboardGroupsChanged() { let nonGroupActors = [this._emojiSelection, this._keypad]; this._aspectContainer.get_children().filter(c => !nonGroupActors.includes(c)).forEach(c => { @@ -2220,9 +2217,6 @@ class KeyboardController extends Signals.EventEmitter { } getCurrentGroup() { - if (Main.inputMethod.terminalMode) - return 'us-extended'; - // Special case for Korean, if Hangul mode is disabled, use the 'us' keymap if (this._currentSource.id === 'hangul') { const inputSourceManager = InputSourceManager.getInputSourceManager();